Could I, as a passenger, get a picture with the pilots in the cockpit before takeoff/after landing? I'm asking specifically about any rules that would deny a passenger into the cockpit. I know this is too broad and subject to change from airline to airline, but generally would I be allowed? What about domestic vs international flights?
I don't know about the situation specifically in the US, but in my - mostly European - experience crew are happy to welcome you to their office after flight.
When I feel the need to see the cockpit or discuss things with the pilots I try to ask the flightcrew before take-off if I can meet them after the flight. Sometimes I explain my interests to the cabin crew and often they will arrange the visit. In a few cases I just asked while deboarding.
Depending on the aircraft type and airport situation you have to think about the logistics a bit. In single aisle aircraft, if you start a discussion with crew while deboarding, you are blocking the queue. This gives the feeling that it is an inconvenient moment and reduces your chances. So if you ask at the last possible moment, make sure most people already exited before you.
However, if passengers are transported to the terminal by bus, you will be holding the bus since you are the last to get off. This reduces the time you can spend in cockpit drastically. If you expect to be bussed to the terminal, ask cabin crew before the descent and don't wait until everybody has exited.
If you were going to try to do something like that, it would depend greatly on the crew. You may be limited to getting the picture taken in the doorway to the cockpit, and for the sake of security, I would suggest after landing (generally when the pilots are doing their, "Bye, thanks for flying" thing as people deplane).
You would probably have to coordiante with the flightcrew, and make sure you are not impeeding progress of other passengers. Furthermore, if you do it, others may want to do the same, so again, that may factor into the decision.
If you are going to try, I would suggest doing it on an airline that has a reputation for being more "fun" (like Southwest). Also, many airlines have a sort of "public affairs" line that you can call and try to pre-coordiante such activity.
As you have said, cockpit entry rules vary depending on the country and even airline.
In the US visitors are fobidden from being in the cockpit when the aircraft is in flight, but to my knowledge it is still legally permissible when parked at the gate. Airlines may have their own rules surrounding entry though.
I haven't tried in the US, but elsewhere I find that heading to the cockpit as really depends on the crew members and workload. Before or after a short flight with a quick turnaround the pilots may rightly say they are too busy. After a long international flight they may just want to get to their hotel!
I suggest that in cruise, when the FAs don't look too busy, just politely ask one of them if it would be possible to visit after the flight - explain that you're an enthusiast, etc. It'll help if you've got a kid with you! Hopefully the FA will ask the flight crew and you'll get a positive answer. If you're really lucky (and in the right part of the world) you might even get an in-flight invite!
Remember that pilots are real people. Most of them quite enjoy showing off their office to excited people when their circumstances permit.