You could, but it would be largely pointless. In the real world, unless you're an entity like NASA (with resources to match), hardware almost never behaves exactly the way it's officially supposed to. Electronics can be simulated perfectly. Mechanical devices? Not so much. Your simulated stepper motor makes certain assumptions about torque, inertia, etc. that are mostly guaranteed to be invalid once you try it in a real device with worn bearings operating running across a shag carpet or wet floor.
The sad fact is, robotics isn't a hobby for poor people. The electronics part is cheap thanks to Arduino and RasPi (and Edison, and ...), but once it's time to start adding hardware, all bets are off. Sure, you can make a sub-$100 robot that can follow lines and avoid running into walls, but the moment you get bored and want to add real sensors & stuff, prepare to fork out some SERIOUS cash.
Just to give one example: Crustcrawler.com's AX12-AHW robotic arm kit. It's $399... not counting the 7 Robotis AX-12A digital servos you'll have to buy for around $45 apiece, and the power supply, and the controller, unless you already have them. Now, this is an awesome, kick-ass robotic arm. It's well-designed, and can probably be used to do useful things. But damn, it's expensive.
All kidding aside, the iRobot Create is one of the best platforms to get started with... it's under $100 at Amazon, and gives you not only the ability to detect walls and collisions, but also gives you the ability to avoid running down stairs & furnishes data about its actual, measured motion.
If you really want to do something meaningful without a real robot, get a cheap webcam for your PC and learn how to use OpenCV. If you ever get to work on a real robot someday, OpenCV programming knowledge will be very useful... especially since RasPi-based robot controllers can use the same cheap webcams as desktop PCs (assuming they support Linux & have open-source drivers you can build for the Pi).
Big tip to programmers who want to get into robotics: if you anticipate needing hardware that can't be purchased off-the-shelf, become friends with a mechanical engineer. They understand things like drivetrains the same way you understand things like recursion & objects... and he (or she) probably finds programming to be about as frustrating and alien as you find trying to bolt things together (dropping screws & nuts into the carpet, gouging your finger with the screwdriver, etc). There's a tiny bit of overlap between the electronic and mechanical realms, but most people who develop robots are teams of two (or more) with complementary skill sets.